﻿using System;
using System.Collections.Generic;
using Medianamik.Core;

namespace Medianamik.UI.Web.MVP.View
{
    public abstract class ModuleViewWithGrid<T> : ModuleViewWithRepository<T>,
        IModuleViewWithGrid
        where T : IModuleView
    {
        public override int PageIndex
        {
            get { return Grid.PageIndex; }
            set { Grid.PageIndex = value; }
        }

        public override IEnumerable<object> DataSource
        {
            set { Grid.DataSource = value; }
        }

        public override int PageSize
        {
            get { return Grid.PageSize; }
            set { Grid.PageSize = value; }
        }

        public override string EditReturnUrl
        {
            get { return Grid.EditReturnUrl; }
            set { Grid.EditReturnUrl = value; }
        }

        public override int TotalCount
        {
            set { Grid.TotalCount = value; }
        }

        public override bool AllowPaging
        {
            get { return Grid.AllowPaging; }
        }

        public override bool AllowSorting
        {
            get { return Grid.AllowSorting; }
        }

        public override Lock.LockInfoToolTip LockInfoTooltip
        {
            get { return Grid.LockInfoTooltip; }
        }

        public abstract IMedianamikGrid Grid { get; }

        public virtual string NodeIdParamName
        {
            get { return DefaultParamNames.NodeID; }
        }

        public string ParentNodeIdParamName
        {
            get { return DefaultParamNames.ParentNodeID; }
        }

        public string HideTreeViewParamName
        {
            get { return DefaultParamNames.HideTreeview; }
        }
    }
}